﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NetFrameworkExtensions.Enterprise.Bus
{
  public sealed class SubscriptionToken : 
    IEquatable<SubscriptionToken>
  {
    private readonly Guid _token = Guid.NewGuid();

    // Methods
    public bool Equals(SubscriptionToken other)
    {
      if (other == null)
      {
        return false;
      }
      return object.Equals(this._token, other._token);
    }

    public override bool Equals(object obj)
    {
      return (object.ReferenceEquals(this, obj) || this.Equals(obj as SubscriptionToken));
    }

    public override int GetHashCode()
    {
      return this._token.GetHashCode();
    }

    public override string ToString()
    {
      return _token.ToString();
    }
  }
}
